package com.mjk.manager.workflow.conf;

import com.mjk.common.core.jdbc.service.plus.idbservice.BeeDBService;
import com.mjk.common.core.jdbc.service.plus.wrap.BeeQueryWrapper;
import com.mjk.common.tools.springextend.BeeApplicationListener;
import com.mjk.manager.workflow.parser.sql.model.ChainModel;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.util.CollectionUtils;

import java.util.List;

/**
 * 业务流 配置类
 * @author Administrator
 *
 */
//@Configuration
public class FlowConfig implements BeeApplicationListener {
	
	
	/**
	 * 构建业务流方法
	 */

    @Override
	public void doApplicationEvent(ContextRefreshedEvent event) {
		BeeDBService beeDBService = event.getApplicationContext().getBean(BeeDBService.class);
		BeeQueryWrapper wrapper = new BeeQueryWrapper(new ChainModel());
		wrapper.eq(ChainModel::getEnable,"1");
        List<ChainModel> chains = beeDBService.findManyByWrapper(wrapper);
		if(!CollectionUtils.isEmpty(chains)) {
            //WorkFlowParse.parseWorkFlow(chain, (ConfigurableApplicationContext)event.getApplicationContext());
        }
	}
}
